A graphics processing unit (GPU) is a dedicated graphics rendering device utilized to manipulate and display computerized graphics on a display. GPUs are built with a highly parallel structure that provides more efficient processing than typical, general purpose central processing units (CPUs) for a range of complex graphics-related algorithms. For example, the complex algorithms may correspond to representations of three-dimensional computerized graphics. A GPU may implement a number of so-called “primitive” graphics operations, such as forming points, lines, and triangles, to create complex, three-dimensional images on a display more quickly than drawing the images directly to the display with a CPU.
Vertex shading and pixel shading are often utilized in the video gaming industry to determine final surface properties of a computerized image, such as light absorption and diffusion, texture mapping, light reflection and refraction, shadowing, surface displacement, and post-processing effects. GPUs typically include a number of pipeline stages such as one or more shader stages, setup stages, rasterizer stages and interpolation stages.
A vertex shader, for example, is typically applied to image data, such as the geometry for an image, and the vertex shader generates vertex coordinates and attributes of vertices within the image data. Vertex attributes may include color, normal, and texture coordinates associated with a vertex. One or more primitive setup and rejection modules may form primitive shapes such as points, lines, or triangles, and may reject hidden or invisible primitive shapes based on the vertices within the image data. An attribute setup module computes gradients of attributes within the primitive shapes for the image data. Once the attribute gradient values are computed, primitive shapes for the image data may be converted into pixels, and pixel rejection may be performed with respect to hidden primitive shapes.
An attribute interpolator then interpolates the attributes over pixels within the primitive shapes for the image data based on the attribute gradient values, and sends the interpolated attribute values to the fragment shader for pixel rendering. Results of the fragment shader are output to a post-processing block and a frame buffer for presentation of the processed image on the display. This process is performed along successive stages of the GPU pipeline.